package com.hj.dapp.business.engineer.controller;

import com.hj.dapp.business.engineer.model.EngineerProject;
import com.hj.dapp.business.engineer.service.EngineerProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author 胡奥程
 * @version 1.0
 * @date 2024/1/24
 */
@RestController
@RequestMapping("/engineerProject")
public class EngineerProjectController {

    @Autowired
    private EngineerProjectService engineerProjectService;
    @GetMapping("/listEngineerProjectByCustomer/{customerId}")
    public List<EngineerProject> listEngineerProjectByCustomer(@PathVariable("customerId") Long customerId) {
        return engineerProjectService.listEngineerProjectByCustomer(customerId);
    }
    @PostMapping("/setDiscountRate")
    public void setDiscountRate(@RequestBody EngineerProject engineerProject) {
        engineerProjectService.setDiscountRate(engineerProject);
    }
    @PostMapping("/setMainDiscountRate")
    public void setMainDiscountRate(@RequestBody EngineerProject engineerProject) {
        engineerProjectService.setMainDiscountRate(engineerProject);
    }

    @GetMapping("/get/{id}")
    public EngineerProject get(@PathVariable("id") Long id) {
       return engineerProjectService.get(id);
    }
}
